package com.hksj.gas.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.common.core.model.Rest;
import com.hksj.gas.dto.GasLargeScreenDTO;
import com.hksj.gas.service.GasLargeScreenService;
import com.hksj.gas.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "医气监测-医气驾驶舱大屏管理")
@RequestMapping("/gas/largeScreen")
@RestController
public class GasLargeScreenController {

    @Autowired
    private GasLargeScreenService gasLargeScreenService;

    @ApiOperation(value = "查询设备概览")
    @PostMapping("/queryGasDeviceStats")
    public Rest<GasDeviceStatsVO> queryGasDeviceStats(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryGasDeviceStats(dto));
    }

    @ApiOperation(value = "查询设备List",response = GasDeviceStatsListVO.class)
    @PostMapping("/queryGasDeviceStatsList")
    public Rest<IPage<GasDeviceStatsListVO>> queryGasDeviceStatsList(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryGasDeviceStatsList(dto));
    }

    @ApiOperation(value = "查询氧气流量使用趋势（七天）")
    @PostMapping("/queryDeviceGasFlowByDate")
    public Rest<List<ProductFlowTypeVO>> queryDeviceGasFlowByDate(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryDeviceGasFlowByDate(dto));
    }

    @ApiOperation(value = "当前报警设备情况")
    @PostMapping("/queryGasAlarmDevice")
    public Rest<GasAlarmDeviceVO> queryAlarmDevice(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryAlarmDevice(dto));
    }

    @ApiOperation(value = "最近七天报警数")
    @PostMapping("/queryGasHistoryAlarmDeviceByTime")
    public Rest<List<GasHistoryAlarmDeviceVO>> queryGasHistoryAlarmDeviceByTime(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryGasHistoryAlarmDeviceByTime(dto));
    }

    @ApiOperation(value = "最近七天报警设备分类")
    @PostMapping("/queryGasAlarmDeviceByType")
    public Rest<List<GasAlarmDeviceTypeVO>> queryGasAlarmDeviceByType(@RequestBody GasLargeScreenDTO dto){
        return Rest.ok(gasLargeScreenService.queryGasAlarmDeviceByType(dto));
    }
}
